package com.ai.controller.made;


import com.ai.annotation.EnterPathParamLog;
import com.ai.common.CommonResponse;
import com.ai.model.param.RegionStaticsViolationParam;
import com.ai.service.made.IRegionManageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 *  区域相关接口
 * @author jiaok
 * @since 2023-07-24
 */
@RestController
@RequestMapping("/region-manage")
public class RegionManageController {

    @Resource
    private IRegionManageService iRegionManageService;

    @ApiOperation("获取所有区域信息")
    @PostMapping("getRegionList}")
    @EnterPathParamLog
    public CommonResponse getRegionList(){
        return iRegionManageService.getRegionList();
    }

    @ApiOperation("统计指定区域月违规、年违规数量")
    @PostMapping("statisticsViolation")
    @EnterPathParamLog
    public CommonResponse statisticsViolation(@RequestBody RegionStaticsViolationParam regionStaticsViolationParam){
        return iRegionManageService.statisticsViolation(regionStaticsViolationParam);
    }

    @ApiOperation("获取每个区域中的摄像头数量")
    @PostMapping("cameraStatistics")
    @EnterPathParamLog
    public CommonResponse cameraStatistics(){
        return iRegionManageService.cameraStatistics();
    }


    @ApiOperation("前五违规项")
    @PostMapping("topFiveViolations")
    @EnterPathParamLog
    public CommonResponse topFiveViolations(){
        return iRegionManageService.topFiveViolations();
    }



    @ApiOperation("区域违规统计")
    @PostMapping("regionalViolation")
    @EnterPathParamLog
    public CommonResponse regionalViolation(){
        return iRegionManageService.regionalViolation();
    }

    @ApiOperation("查看当前区域所绑定的摄像头")
    @PostMapping("getBindList/{id}")
    @EnterPathParamLog
    public CommonResponse getBindList(@PathVariable(name = "id") String id){
       return iRegionManageService.getBindListID(id);
    }


    @ApiOperation("区域管理摄像头")
    @PostMapping("manageCamera/{id}")
    @EnterPathParamLog
    public CommonResponse manageCamera(@PathVariable(name = "id") String id , @RequestBody List<String> cameraIds){
        return iRegionManageService.manageCamera(id,cameraIds);
    }


    @ApiOperation("获取当前cpu、GPU、内存情况")
    @PostMapping("deviceInformation")
    @EnterPathParamLog
    public CommonResponse deviceInformation(){
        // TODO: 2023-08-24 待完成
        return iRegionManageService.deviceInformation();
    }



}
